<%@ page import="com.goal98.team.domain.Position" %>
<head>
  <meta name="layout" content="main"/>
  <title><g:message code="register.edit.title" default="Edit Profile"/></title>
</head>

<body>

  %{--<div class="nav">
        <span class="menuButton"><a class='home' href="${createLinkTo(dir:'')}">Home</a></span>
    </div>--}%

  <div class="body">
    <h1><g:message code="register.edit.title" default="Edit Profile"/></h1>
    <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${person}">
      <div class="errors">
        <g:renderErrors bean="${person}" as="list"/>
      </div>
    </g:hasErrors>

    <g:form>
      <input type="hidden" name="id" value="${person.id}"/>
      <input type="hidden" name="version" value="${person.version}"/>
      <div class="dialog">
        <table>
          <tbody>
            <tr class='prop'>
              <td valign='top' class='name'><label for='username'><g:message code="register.id" default="Login Name"/>:</label></td>
              <td valign='top' class='value ${hasErrors(bean: person, field: 'username', 'errors')}'>
                <input type="hidden" name='username' value="${person.username?.encodeAsHTML()}"/>
                <div style="margin:3px">${person.username?.encodeAsHTML()}</div>
              </td>
            </tr>

            <tr class='prop'>
              <td valign='top' class='name'><label for='userRealName'><g:message code="register.fullName" default="Full Name"/>:</label></td>
              <td valign='top' class='value ${hasErrors(bean: person, field: 'userRealName', 'errors')}'>
                <input type="text" name='userRealName' value="${person.userRealName?.encodeAsHTML()}"/>
              </td>
            </tr>

            <tr class="prop">
              <td valign="top" class="name"><label for="position.id"><g:message code="player.position" default="Position"/>:</label></td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'position', 'errors')}">
                <g:select from="${Position.list()}" name="position.id" optionKey="id" value="${person.position?.id}"/>
              </td>
            </tr>

            <tr class='prop'>
              <td valign='top' class='name'><label for='passwd'><g:message code="register.password" default="Password"/>:</label></td>
              <td valign='top' class='value ${hasErrors(bean: person, field: 'passwd', 'errors')}'>
                <input type="password" name='passwd' value=""/>
              </td>
            </tr>

            <tr class='prop'>
              <td valign='top' class='name'><label for='repasswd'><g:message code="register.password.confirm" default="Confirm Password"/>:</label></td>
              <td valign='top' class='value ${hasErrors(bean: person, field: 'passwd', 'errors')}'>
                <input type="password" name='repasswd'/>
              </td>
            </tr>

            <tr class='prop'>
              <td valign='top' class='name'><label for='receiveEmail'><g:message code="register.receiveEmail" default="Receive Email"/>:</label></td>
              <td valign='top' class='value ${hasErrors(bean: person, field: 'receiveEmail', 'errors')}'>
                <g:checkBox name='receiveEmail' value="${person.receiveEmail}"></g:checkBox>
              </td>
            </tr>
            %{--<tr class='prop'>
                       <td valign='top' class='name'><label for='email'><g:message code="register.email" default="Email"/>:</label></td>
                       <td valign='top' class='value ${hasErrors(bean:person,field:'email','errors')}'>
                           <input type="text" name='email' value="${person.email?.encodeAsHTML()}"/>
                       </td>
                   </tr>--}%

            %{--<tr class='prop'>
              <td valign='top' class='name'><label for='emailShow'><g:message code="register.showEmail" default="Show Email"/>:</label></td>
              <td valign='top' class='value ${hasErrors(bean: person, field: 'emailShow', 'errors')}'>
                <g:checkBox name='emailShow' value="${person.emailShow}"></g:checkBox>
              </td>
            </tr>--}%

          </tbody>
        </table>
      </div>

      <div class="buttons">
        <span class="button"><g:actionSubmit class='save' value="${message(code:'button.edit', 'default':'Update')}" action="update"/></span>
      </div>

    </g:form>

  </div>
</body>
